import java.io.*;

public class Demo2 {
    public static void main(String[] args) {
        try(OutputStream outputStream = new FileOutputStream("test.txt")) {
            PrintWriter printWriter = new PrintWriter(outputStream);
            printWriter.write("Hello");

            //刷新缓冲区
            printWriter.flush();
        }catch(IOException e) {
            e.printStackTrace();
        }
    }
}
